<?php
namespace Badmins\Model;
use Think\Model;
class WxAutoreplyModel extends Model{
	protected $_validate = array(
			array('name','require','关键字必须'),
			array('status','number','类型必须'),
			array('status_id','ckstatus','类型相关内容填写错误',1,'callback',3),
	);
	protected $_auto = array (
			array ('status_id','ckstatus',3,'callback',1),
	);
	public function ckstatus(){
		$status = I('status');
		switch ($status){
			case '1':
				//文本
				if(empty($_POST['text_id'])){
					return false;
				}else{
					return $_POST['text_id'];
				}
				break;
			case '2':
				//图文
				if(empty($_POST['imgtxt_id'])){
					return false;
				}else{
					return $_POST['imgtxt_id'];
				}
				break;
			case '3':
				//语音
				if(empty($_POST['voice_id'])){
					return false;
				}else{
					return $_POST['voice_id'];
				}
				break;
			case '4':
				//视频
				if(empty($_POST['video_id'])){
					return false;
				}else{
					return $_POST['video_id'];
				}
				break;
			case '5':
				//图片
				if(empty($_POST['image_id'])){
					return false;
				}else{
					return $_POST['image_id'];
				}
				break;
			default:
				return 0;
				break;
		}
	}
}